<?php

namespace App\Http\Controllers\Home\Set;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Home\Users as UsersModel;
use LoginLog;
use Tools;
use Users;

class LoginLogController extends Controller
{
    public function login_log(Request $request)
    {
        $page = $request->input('page');

        $uid = $request->input('uid');

        $opt = [];

        if ($uid){

            $opt['uid'] = $uid;

        }

        $user_list = Users::getList();

        $page_info = Tools::page_helper($page,config('base.home_limit.base_limit.render_limit'),config('base.home_limit.base_limit.limit'));

        $list = LoginLog::getList($page_info['skip'],$page_info['limit'],$opt);

        $count = LoginLog::getCount($opt);

        $num = intval(ceil($count/config('base.home_limit.base_limit.limit')));

        return view('Home.User.Set.login-log',compact('user_list','list','page','uid','num'));
    }


}